package com.itheima.config;

import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;

//配置类用@Configuration 等价于配置文件
@Configurable
//指定扫描
@ComponentScan(basePackages = "com.itheima")
//绑定配置文件
@PropertySource(value = "classpath:jdbc.properties",encoding = "utf-8")
public class SpringConfig {

    @Bean
    public User myUser(){
        User user = new User();
        user.setUserName("胡歌");
        user.setAge(18);
        return user;
    }

}
